#pragma once
#include"BucketHash.h"

namespace xxhhdzl
{
	template<class k,class HashFunction = HashFun<k>>
	class unordered_set
	{
		class keyoft
		{
		public:
			const k& operator()(const k& key) const
			{
				return key;
			}
		};

	public:
		typedef typename BucketHash<k,k, keyoft, HashFunction>::const_iterator iterator;
		typedef typename BucketHash<k,k, keyoft, HashFunction>::const_iterator const_iterator;


		unordered_set()
		{}

		iterator begin() 
		{
			return HashTable.begin();
		}

		const_iterator begin() const
		{
			return HashTable.begin();
		}

		iterator end()
		{
			return HashTable.end();
		}

		const_iterator end() const
		{
			return HashTable.end();
		}

		pair<iterator,bool> insert(const k& value)
		{
			auto ret = HashTable.insert(value);
			return make_pair(iterator(ret.first), ret.second);
		}

		iterator find(const k& key)
		{
			return HashTable.find(key);
		}

		size_t size()
		{
			return HashTable.size();
		}

		bool erase(const k& key)
		{
			return HashTable.erase(key);
		}

		bool empty()
		{
			return HashTable.empty();
		}

	private:
		BucketHash<k, k, keyoft, HashFunction> HashTable;
	};
}